<template>
  <div class="chapter">
    <div class="title">
      <i class="iconfont icon-xiangzuo" @click="$router.go(-1), change()"></i>
      <div class="story">我的特权</div>
    </div>

    <div class="chaptercontent">
      <div class="feelChapter">
        <h1>免费章节券说明</h1>
        <p>
          1. 免费章节券可以任选<span>按章付费书籍的任意章节</span>进行兑换使用
        </p>
        <p>
          2.
          1张章节券可免费阅读1个付费章节，在购买时勾选“使用会员权益”即可免费阅读
        </p>
        <p>3. 请注意免费章节券的使用有效期，过期无效</p>
        <p>4. 免费章节券最终解释权归橙子小说所有</p>
      </div>
    </div>

    <div class="chapterMes">
      <div class="chapfont">
        <p>为你推荐</p>
        <span>根据你的阅读兴趣推荐</span>
      </div>
      <ul>
        <li
          v-for="item in publicContent"
          :key="item.id"
          @click="$router.push({ name: 'synopsis', query: { id: item.id } })"
        >
          <div class="img">
            <img :src="item.img" />
          </div>
          <p>{{ item.title }}</p>
        </li>
      </ul>

      <div class="btnChap">
        换一换
        <i class="iconfont icon-huanyihuan1"></i>
      </div>
    </div>
    <div class="chapterBtm"></div>
  </div>
</template>

<script>
import { getRecommendRank } from "../../api/index";
export default {
  data() {
    return {
      publicContent: [],
    };
  },
  methods: {
    change() {
      this.$emit("getnavs-btn", true);
    },
  },
  created() {
    this.$emit("getnavs-btn", false);
    getRecommendRank().then((data) => {
      this.publicContent = data.recommendRank.like;
    });
  },
};
</script>

<style lang="less">
.chapter {
  .title {
    position: fixed;
    width: 100%;
    min-height: 50px;
    display: flex;
    background-color: #fff;
    z-index: 1;
    i {
      flex: 0 0 40px;
      text-align: center;
      line-height: 50px;
      font-size: 20px;
    }
    .story {
      flex: 1;
      text-align: center;
      line-height: 50px;
      font-size: 18px;
      padding-right: 40px;
    }
  }
  .chaptercontent {
    padding-top: 50px;
    .feelChapter {
      margin-top: 2px;
      background-color: #fff;
      padding: 0 12px;
      h1 {
        padding: 15px 0;
        font-weight: 600;
      }
      p {
        font-size: 13px;
        padding: 4px 0;
        line-height: 16px;
        span {
          color: #d70707;
        }
      }
    }
  }
  .chapterMes {
    margin-top: 6px;
    background-color: #fff;
    padding: 12px;
    padding-bottom: 0;
    position: relative;
    .chapfont {
      display: flex;
      align-items: baseline;
      p {
        font-size: 14px;
        margin-right: 4px;
      }
      span {
        color: #999;
        font-size: 12px;
      }
    }
    &::after {
      content: "";
      display: block;
      width: 2px;
      height: 13px;
      background-color: #f2832a;
      position: absolute;
      top: 12px;
      left: 0;
    }
    ul {
      padding: 15px 0;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      li {
        margin-bottom: 4px;
        margin-right: 15px;
        .img {
          img {
            width: 70px;
            height: 90px;
          }
        }
        p {
          font-size: 12px;
          padding: 4px 0;
          width: 70px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
      :nth-child(4),
      :nth-child(8) {
        margin-right: 0;
      }
    }
    .btnChap {
      border-top: 2px solid #f6f7f9;
      text-align: center;
      padding: 10px;
      font-size: 14px;
    }
  }
  .chapterBtm {
    margin-top: 8px;
    padding: 12px;
    background-color: #fff;
  }
}
</style>